<?php
/**
 * Created by PhpStorm.
 * User: divya
 * Date: 2018/7/26
 * Time: 下午5:55
 */

namespace app\api\model;


use think\Model;

class BaseModel extends Model
{
    protected $hidden = ['update_time','delete_time',
        'topic_img_id','head_img_id'];
    public function getUrlAttr($value,$data){
        $finalUrl = $value;
        if ($data['from'] == 1){
            $finalUrl = config('setting.img_prefix').$finalUrl;
        }
        return $finalUrl;
    }
    public function img(){
        return $this->belongsTo('Image','img_id','id');
    }
}